﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="油管计划及发货量.aspx.cs" Inherits="syc.Sale.Report.油管计划及发货量" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <script type="text/javascript" language="javascript" src="/common.js"></script>
</head>
<body>
    <form id="form1" runat="server">
   <div>
   
           <div class="hooo">
        <div id="wintop" class="wintop"><span lang="zh-cn"><u>油管计划及发货量</u></span></div>
        <asp:Panel ID="Panel1" runat="server" CssClass="panel" Height="36px" >
  
        <table>
        <tr id="row2" runat="server">
        <td>
        年份:
        </td>
        <td>
        <asp:DropDownList ID="DList_year" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DList_year_SelectedIndexChanged">
            <asp:ListItem>2009</asp:ListItem>
            <asp:ListItem>2010</asp:ListItem>
            <asp:ListItem>2011</asp:ListItem>
            <asp:ListItem>2012</asp:ListItem>
            <asp:ListItem>2013</asp:ListItem>
            <asp:ListItem>2014</asp:ListItem>
            <asp:ListItem>2015</asp:ListItem>
            <asp:ListItem></asp:ListItem>
        </asp:DropDownList>
        </td>
        <td>
        行政月：
        </td>
        <td>
        <asp:DropDownList ID="DList_month" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DList_month_SelectedIndexChanged">
            <asp:ListItem>1</asp:ListItem>
            <asp:ListItem>2</asp:ListItem>
            <asp:ListItem>3</asp:ListItem>
            <asp:ListItem>4</asp:ListItem>
            <asp:ListItem>5</asp:ListItem>
            <asp:ListItem>6</asp:ListItem>
            <asp:ListItem>7</asp:ListItem>
            <asp:ListItem>8</asp:ListItem>
            <asp:ListItem>9</asp:ListItem>
            <asp:ListItem>10</asp:ListItem>
            <asp:ListItem>11</asp:ListItem>
            <asp:ListItem>12</asp:ListItem>
        </asp:DropDownList>
        </td>
        <td><asp:Button ID="Button1" runat="server" CssClass="button" Text="导出" onclick="Button1_Click" /></td>
        </tr>
        </table>
        </asp:Panel>
        <asp:Panel ID="Panel2" runat="server" CssClass="panel2" >
        <asp:Label ID="Message" runat="server" Text="·准备就绪" CssClass="prompt" Visible="True"></asp:Label>
        </asp:Panel> 
    
        <h1 style="text-align: center;">
            <%=year %>年油管计划量及发货量</h1>
        <div align="center">    
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource1" BorderColor="Black" 
                BorderStyle="Solid" BorderWidth="2px" OnRowDataBound="MyGrid_RowDataBound">
                 <RowStyle Height="40px" />
                 <HeaderStyle Height="40px" />                
            <Columns>
                <asp:BoundField DataField="订货单位" HeaderText="订货单位" 
                    SortExpression="订货单位" ReadOnly="True" ItemStyle-Width="200"/>
                <asp:BoundField DataField="合同编号" HeaderText="合同编号" SortExpression="合同编号" ItemStyle-Width="200"/>
                <asp:BoundField DataField="订货量" HeaderText="订货量" SortExpression="订货量" ItemStyle-Width="200"/>
                <asp:BoundField DataField="出货量" HeaderText="出货量" SortExpression="出货量" 
                    ReadOnly="True" ItemStyle-Width="200"/>
                <asp:BoundField DataField="日期" HeaderText="日期" SortExpression="日期" 
                    DataFormatString="{0:d}" ItemStyle-Width="200"/>
                <asp:BoundField DataField="完成日期" HeaderText="完成日期" SortExpression="完成日期" 
                    DataFormatString="{0:d}" ItemStyle-Width="200"/>

            </Columns>
        </asp:GridView>
        </div>
    
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
            SelectCommand="SELECT 
	'丰原公司-' + dbo.产品订货单位.名称 AS 订货单位, 
	ht.合同编号, 
	dbo.产品.品名 AS 产品, 
	ht.数量 AS 订货量, 
	(SELECT isnull(SUM(总重量),0) AS 出货量
	 FROM   dbo.产品出库单
	 WHERE 合同ID=ht.ID
	) AS 出货量,
    (convert(numeric(5,2),(ht.数量*100/(SELECT SUM(总重量) AS 出货量 FROM dbo.产品出库单 WHERE 合同ID=ht.ID)))
    ) AS 完成率,
	ht.日期,
	ht.完成日期
FROM dbo.产品销售合同 as ht
	 INNER JOIN
     dbo.产品订货单位 ON 
			ht.订货单位ID = dbo.产品订货单位.ID AND 
			ht.收货单位ID = dbo.产品订货单位.ID 
	 INNER JOIN
			dbo.产品 ON 
			ht.产品ID = dbo.产品.ID
WHERE ht.产品ID=1 AND YEAR(ht.日期)=2010 AND MONTH(ht.日期)=9"></asp:SqlDataSource>
    
    </div>
    </form>
 <script>parent.hidesubmenu(true);</script>
</body>
</html>
